Phpfox.IAI = {
	fetchUsers : function()
	{
		// show the "searching" message
		$('#iaiSearching').show();
		// call the ajax search
		var iDays = $('#iaiDaysInput').val();
		if (isNaN(parseInt(iDays)) || (iDays < 1)) 
		{
			alert(getPhrase('iaip1.number_of_days'));
			return false;
		}
		$.ajaxCall('iaip1.fetchUsers', 'iDays=' + iDays);
	},
	
	deleteUsers : function()
	{
		if (!confirm(getPhrase('core.are_you_sure')))
		{			 
			 return false;
		}
		// get all of the user ids
		var sIds = new Object;
		$('.iaiChkInactive:checked').each(function(){
			sIds[parseInt($(this).val())] = (parseInt($(this).val()));
		});		
		
		var jIds = JSON.stringify(sIds);
		debug(jIds);
		if (jIds == '{}')
		{
			alert (getPhrase('iaip1.please_select_at_least_one_user'));
			return false;
		}
		$.ajaxCall('iaip1.deleteUsers', 'aUsers=' +jIds+'');
	}
};
